package com.graduate.cec.controller;


import com.graduate.cec.common.JsonPage;
import com.graduate.cec.common.JsonResult;
import com.graduate.cec.pojo.dto.AuthenticationSimpleDTO;
import com.graduate.cec.pojo.dto.FeedbackSimpleDTO;
import com.graduate.cec.pojo.dto.LoginDTO;
import com.graduate.cec.pojo.entity.Admin;
import com.graduate.cec.pojo.entity.Article;
import com.graduate.cec.pojo.entity.Authentication;
import com.graduate.cec.pojo.entity.Feedback;
import com.graduate.cec.pojo.vo.AdminSimpleVO;
import com.graduate.cec.pojo.vo.AuthenticationVO;
import com.graduate.cec.pojo.vo.FeedbackVO;
import com.graduate.cec.service.AdminService;
import com.graduate.cec.service.AuthenticationService;
import com.graduate.cec.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping(value = "/authentication",produces = "application/json;charset=utf-8")
@Api(tags = "管理员")
public class AuthenticationController {
    @Resource
    private AuthenticationService authenticationService;

    @Resource
    private LoginService login;
    /****************        增       ******************************************************************/

    @GetMapping("/insert-authentication")
    @ApiOperation("增加评论")
    public JsonResult<Void> insertFeedback(Authentication authentication){
        authenticationService.insertFeedback(authentication);
        log.info("feedback:{}",authentication);
        return JsonResult.ok("插入成功");
    }

    /****************        删       ******************************************************************/



    /****************        改       ******************************************************************/
    @PostMapping("/update-by-key")
    @ApiOperation("通过主键修改内容")
    public JsonResult<Void> updateByKey(@RequestBody Authentication authentication){
        log.info("authentication:{}",authentication);
        authenticationService.updateByKey(authentication);
        return JsonResult.ok("修改成功");
    }


    /****************        查        ******************************************************************/


    @GetMapping("/get-list-by-example")
    @ApiOperation("通过一定条件查找列表")
    public JsonResult<JsonPage<AuthenticationVO>>getListByExample(AuthenticationSimpleDTO authenticationSimpleDTO){
        return JsonResult.ok("查询成功",authenticationService.getListByExample(authenticationSimpleDTO));
    }




}
